using ShopPowerTemplate.Common.Validation;
using System;

namespace ShopPowerTemplate.ValidationControls
{
    public class EulaValidationControl : ValidationControl
    {
        public EulaValidationControl()
            : base()
        {
            ValidationMessage.Text = "* must accept Condition Terms";
        }

        public override bool Validate()
        {
            bool isValid = PropertyToValidate is bool && (bool)PropertyToValidate;

            if (isValid)
            {
                ValidationMessage.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            }
            else
            {
                ValidationMessage.Visibility = Windows.UI.Xaml.Visibility.Visible;
            }

            return isValid;
        }
    }
}
